<%@ page contentType="text/html; charset=utf-8"%>
<script type="text/javascript">
  jQuery(document).ready(function(){
	
    var mygrid = jQuery("#list").jqGrid({
    	url:'/stat/workflow/allcurrent',
        datatype: "json",
        mtype: 'GET',
        colNames:['流程名称','活动名','发起者','发起时间','来自','发来时间','监控'],
        colModel :[ 
        {name:'workflowName', index:'workflowName', width:150,formatter:nameFormater},
        {name:'actionName', index:'actionName', width:200},
        {name:'starter', index:'starter', width:100 }, 
        {name:'startDate', index:'startDate', width:150 }, 
        {name:'sender', index:'sender', width:100 }, 
        {name:'sendDate', index:'lastSendDate', width:150 }, 
        {name:'workflowId', index:'workflowId', width:100,formatter:doWatchFormatter },
      ],
      pager:'#pager',
      rowNum:10,
      rowList:[10,20,30],
      sortname: 'lastSendDate',
      sortorder: 'desc',
      viewrecords: true,
      caption: '所有当前',
      width:'790',
      height:'300',
      jsonReader: {
  		repeatitems : false,
  		id: "0"
  	  }
    }); 
    
     function nameFormater(cellvalue,optionss,rowObject){
    	return cellvalue+"["+rowObject['workflowId']+"]";
    }
     function doWatchFormatter(cellvalue ,options,rowObject){
	      //alert(cellvalue);
	      var url  ="workflow/monitor.action?workflowId="+rowObject['workflowId'];
	      var link = $("<a style='color:green;font-weight:bold' onclick=\"doAjaxLink('"+url+"');return false;\"></a>");
	      link.attr("href","javascript:;");
	      link.text("监控");
	      return $("<span></span>").append(link).html();
    } 
   
}); 
</script>

<div id="jqgrid">
<table id="list"></table>
<div id="pager"></div>
</div>